package com.huanbao.uav.controller;

import com.huanbao.common.api.CommonResult;
import com.huanbao.uav.service.UavDeviceConfigService;
import lombok.extern.slf4j.Slf4j;
import org.javatuples.Triplet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

/* ━━━━━━佛祖保佑━━━━━━
 *                  ,;,,;
 *                ,;;'(    社
 *      __      ,;;' ' \   会
 *   /'  '\'~~'~' \ /'\.)  主
 * ,;(      )    /  |.     义
 *,;' \    /-.,,(   ) \    码
 *     ) /       ) / )|    农
 *     ||        ||  \)
 *     (_\       (_\
 * ━━━━━━永无BUG━━━━━━
 * @author ：wangwj
 * @description: 无人机设备配置
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 */
@Slf4j
@RestController
@RequestMapping("/uavDeviceConfig")
public class UavDeviceConfigController {

    @Autowired
    UavDeviceConfigService uavDeviceConfigService;

    /**
     * @Title: queryAllUavBrand
     * @Description: 查询所有品牌
     * @return
     * @return Object 返回类型
     * @throws
     */

    @SuppressWarnings({"rawtypes", "unchecked"})
    @RequestMapping(value = "queryAllUavBrand", method = {RequestMethod.POST})
    public CommonResult queryAllUavBrand(@RequestBody Map<String, Object> m) {
        log.debug("queryAllUavBrand request start param: {}",m);
        CommonResult resu=null;

        // 校验参数在服务层处理逻辑

        Triplet<Long, String, LinkedHashMap> res = uavDeviceConfigService.queryAllUavBrand();
        if(null != res) {
            resu=CommonResult.success(res.getValue0(),res.getValue2(),res.getValue1());
        }else {
            resu=CommonResult.failed();
        }

        log.debug("queryAllUavBrand request end ret: {}",resu);

        return resu;
    }

}